#include "ice/ice_agent.h"
#include "pc/session_description.h"

namespace xrtc {

// 管理PeerConnection的所有传输通道    
class TransportController : public sigslot::has_slots<> {
public:
    TransportController(EventLoop* el, PortAllocator* allocator);
    ~TransportController() = default;
    
    // 设置本地描述，创建通道，收集candidate
    int set_local_description(SessionDescription* desc);
    // 解析Answer之后，设置远端描述
    int set_remote_description(SessionDescription* desc);

private:    
    void on_candidate_allocate_done(IceAgent* agent,
            const std::string& transport_name,
            IceCandidateComponent component,
            const std::vector<Candidate>& candidates);

public:
    sigslot::signal4<TransportController*, const std::string&, IceCandidateComponent,
        const std::vector<Candidate>&> signal_candidate_allocate_done;

private:
    EventLoop* m_el;
    IceAgent* m_ice_agent;
    
};


}